package org.geeks.gslog4j2.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.stream.IntStream;

@Slf4j
@RestController
public class LogController {

  @GetMapping("info")
  public String info(Integer type) {
    long begin = System.currentTimeMillis();

    IntStream.range(0, 10000)
        .forEach(
            i -> {
              log.info("Hello, {}", "world", new NumberFormatException("Mock exception"));
            });

    System.err.println("Mission complete in " + (System.currentTimeMillis() - begin) + " ms");

    return "ok";
  }
}
